﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DnaServiceLib
{
    public static class StringExtension
    {
        public static bool IsNumeric(this string stringToTest)
        {

            int result;

            return int.TryParse(stringToTest, out result);

        }
        public static string Left(this string inputString, int length)
        {

            if (length > inputString.Length)
                return inputString;

            return inputString.Substring(0, length);

        }
        public static string Right(this string inputString, int length)
        {

            if (length > inputString.Length)
                return inputString;

            int startIndex = inputString.Length - length;
            return inputString.Substring(startIndex, length);

        }
    }
}
